﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_buy_SucceedPay:Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            ResultCommand();
    }
    protected void ResultCommand()
    {
        string[] meg = { Request.QueryString["payInterface"], Request.QueryString["money"], Request.QueryString["NetPayMent"], Request.QueryString["DB"] };

        if (string.IsNullOrEmpty(meg[1]))//monery为空时显示“0元”
            lblMoney.Text = "0 元";
        else
            lblMoney.Text = meg[1] + " 元";

        if (meg[2] != "true" || meg[3] != "true")//支付状态和数据库写入其中一个不成功时
        {
            if (meg[2] == "true" && meg[3] != "true")//当支付成功时
            {
                lblNetPayMent.Text = "网上支付成功,写入数据库失败。";
                lblSM.Text = "钱已支付到对方账户，但写入本地数据库失败，请与我公司业务人页联系,给您带来不便请谅解";
            }
            else//支付失败时直接显示失败然后返回
            {
                lblpayresultitle.Text = "支付失败";
                lblpayresult.Text = "订单支付失败，请重试！";

                lblNetPayMent.Text = "网上支付失败。";
                lblSM.Text = "支付失败，请重新支付。";
                //hlink.NavigateUrl = "../Common/WaitPay.aspx?orderid=" + Request["orderid"] + "";
                //hlink.Text = "重新支付订单";
                return;
            }
        }
        else//支付状态和数据库写入都成功时
        {
            lblpayresultitle.Text = "支付成功";
            lblpayresult.Text = "您已经支付成功！";
            lblNetPayMent.Text = "网上支付成功。";
            lblDB.Text = "数据写入成功。";
            lblSM.Text = "恭喜您支付成功！";
            //hlink.NavigateUrl = "~/default.aspx";
            //hlink.Text = "返回首页>>";
        }
    }
}
